<template>
  <el-container class="home__container">
    <!-- 侧栏 -->
    <el-aside width="200px">
      <h1 class="title" style="height:60px"></h1>
			  <el-menu :default-active="$route.path"
				    class="el-menu-vertical-demo"
				    text-color="#4e5bf8"
			    	ref="sideMenu"
				    active-text-color="#E47833"
				    :collapse="false">
				    <!-- //我们的组件 -->
				    <qf-sub-menu :sideMenu='$store.state.sideMenu'></qf-sub-menu>
			  </el-menu>
    </el-aside>
    <el-container>
      <!-- 顶部区域 -->
      <el-header>
        <el-row type="flex" 
            class="row-bg" 
            justify="space-between ">
          <el-col :span="6">
              <div class="grid-content left">
                  <i class="iconfont icon-shou-qi"></i>
              </div>
              </el-col>
          <el-col :span="6">
              <div class="grid-content center">
                  <h1>CRM系统</h1>
              </div>
              </el-col>
          <el-col :span="6">
              <div class="grid-content right">
                  <el-avatar shape="square" :size="40" :src="userInfo.headimgurl"></el-avatar>

                  <b>欢迎光临<span class="nickname"> {{userInfo.nickname}} </span></b>
                  &nbsp;
                  <b @click="quit" class="quit">到钟了</b>
              </div>
              </el-col>
        </el-row>
      </el-header>
      <!-- 主体区域 -->
      <el-main>
          <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>

import * as permissionApi from '../../api/permission'

import { mapState } from "vuex";
export default {
  mounted(){
this.userInfo=JSON.parse(localStorage.getItem('crm-userInfo'))
console.log(this.userInfo);
  },
   
  data(){
    
    return{
     userInfo:[],
    }
  },
  created(){
    permissionApi.getMenulistApi()
    .then(res=>{
      console.log(res);
    })
  },
  methods:{
    quit(){//退出登录

    //清除token
      localStorage.removeItem('yf-token')
    //跳转到登录页
    this.$router.push('/login')

    }
  }
}
</script>

<style lang="less" scoped>
.el-header {
  min-height: 60px!important;
  background-image: linear-gradient(135deg,#a4ea,pink);
  color: #fff;
  font-weight: bolder;
  text-align: center;
  line-height: 60px;

  .left{
    text-align: left;
    i{
      font-size: 30px;
      cursor: pointer;
    }
  }
  .center{
    font-size: 30px;
  }
  .el-avatar{
    vertical-align: middle;
    margin-right: 10px;
  }
  .quit{
    color: deeppink;
    text-decoration: underline;
    cursor: pointer;
  }
  .nickname{
    margin-left: 5px;
    color: deeppink;
  }
}

.el-aside {
  background-image: linear-gradient(135deg,#a4ea,pink);
  color: #333;
  text-align: center;
  // line-height: 200px;
  .logo{
    min-height: 60px;
    background-color: #fff;
  }
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  // line-height: 160px;
}

body > .el-container {
  margin-bottom: 40px;
}



.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
//顶栏 laout
.el-row {
    margin-bottom: 20px;
    &:last-child {
      margin-bottom: 0;
    }
  }
  .el-col {
    border-radius: 4px;
  }

  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }
  
</style>
